<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>首页</title>
    <script src="../static/jQuery/jquery-2.2.3.min.js"></script>
    <script src="../static/angularjs/angular.min.js"></script>
    <script src="../static/layer/layer.js"></script>

    <script>

        //默认加载方法
        window.onload = findAll;
        var app = angular.module("indexApp", []);
        //绑定控制器
        app.controller("indexController", function ($scope, $http) {
            $http.post("/address/update").success(function (resp) {
                $scope.resp=findAll;

            })
        });

        //查询所有
        function findAll() {
            $.get("address/list", null, function (data) {
                // $("#content").append(data);
                $.each(data, function (i, n) {

                    $("#collegeLcationID").append(n.collegelcationid);
                    $("#address").append(n.address);
                    $("#name").append(n.name);
                    $("#module").append(n.mobile);
                    // console.log(n.collegeLcationid);
                });

            }, "json");
        }

        //修改方法
        function update() {
            // $.post("address/update")

            //弹出层
            layer.open({
                type: 1,
                area: ['500px', '600px'],
                title: '地址修改'
                , content: $("#test"),
                shade: 0,
                btn: ['修改', '取消 ']
                , btn1: function (index, layero) {
                    var kk = $("#username").val();
                    alert(kk);
                    return true;
                },
                btn2: function (index, layero) {
                    alert("是否取消修改");
                    return true;
                },
                cancel: function (layero, index) {
                    layer.closeAll();
                }

            });

        }

        //删除方法
        function del() {

        }

        //添加方法
        function insert() {
            $.get("", function (date) {
                console.log("成功");
            }, "html");

        }

    </script>

</head>
<body ng-app="indexApp" ng-controller="indexController">
<input type="hidden" value="查询" onclick="findAll()"/>
<!--<div id="content"></div>-->
<h4>地址信息</h4>
<table>
    <tr>
        <th>学号</th>
        <th>地址</th>
        <th>名字</th>
        <th>电话</th>
    </tr>
    <tr id="content">
        <td id="collegeLcationID">&nbsp;</td>
        <td id="address">&nbsp;</td>
        <td id="name">&nbsp;</td>
        <td id="module">&nbsp;</td>
        <td id="up"><input type="button" id="update" value="修改" ng-model="update" onclick="update()"
                           ng-cloak="update()">&nbsp;</input></td>
        <td id="delete"><input type="button" id="del" value="删除" ng-cloak="del()" onclick="del()">&nbsp;</input></td>
    </tr>
</table>

<br/>
<from id="add">
    学 号: <input type="text" value="请输入学号"><br/>
    地 址: <input type="text" value="请输入地址"> <br/>
    姓 名: <input type="text" value="请输入姓名"><br/>
    手 机 号: <input type="text" value="请输入手机号"><br/>

</from>


<form class="layui-form" id="test" style="display:none">
    <div class="layui-form-item">
        <label class="layui-form-label">学号</label>
        <div class="layui-input-block">
            <input type="text" name="collegeLcationid" required lay-verify="required" placeholder="请输入标题"
                   autocomplete="on"
                   class="layui-input" id="username" style="width:100px">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">地址</label>
        <div class="layui-input-inline">
            <input type="text" name="address" required lay-verify="required" placeholder="" autocomplete="on"
                   class="layui-input">

        </div>
    </div>
    <!-- <div class="layui-form-item">
         <label class="layui-form-label">选择框</label>
         <div class="layui-input-block">

         </div>
     </div>
     <div class="layui-form-item">
         <label class="layui-form-label">复选框</label>
         <div class="layui-input-block">
             <input type="checkbox" name="like[write]" title="写作" lay-skin="primary">
             <input type="checkbox" name="like[read]" title="阅读" checked lay-skin="primary">
             <input type="checkbox" name="like[dai]" title="发呆" lay-skin="primary">
         </div>
     </div>
     <div class="layui-form-item">
         <label class="layui-form-label">开关</label>
         <div class="layui-input-block">
             <input type="checkbox" name="switch" lay-skin="switch" lay-text="开启|关闭">
         </div>
     </div>
     <div class="layui-form-item">
         <label class="layui-form-label">单选框</label>
         <div class="layui-input-block">
             <input type="radio" name="sex" value="男" title="男">
             <input type="radio" name="sex" value="女" title="女" checked>
         </div>
     </div>-->
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">姓名</label>
        <div class="layui-input-block">
            <input type="text" name="username" placeholder="请输入内容" class="layui-textarea"/>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">手机号</label>
        <div class="layui-input-inline">
            <input type="text" name="module" required lay-verify="required" placeholder="请输入手机号" autocomplete="on"
                   class="layui-input">
        </div>
    </div>
</form>
<button id="div">提交</button>
{{user.address}}

</body>
</html>